import store from '../store'

/**
 * @author tangjia
 * @desc 监听页面刷新状态
 * @param $route
 */
export default function refresh($route) {
  let isRefresh = store.state.isRefresh
  if (isRefresh === false) return
  if (Object.keys($route.matched[1].instances).length === 0 || !$route.matched[1].instances.default.refresh) return
  $route.matched[1].instances.default.refresh()
  store.commit('SetRefresh', false)
}
